package com.superhelper.printer.server;

import java.io.UnsupportedEncodingException;

import com.google.common.primitives.UnsignedBytes;

import io.netty.channel.Channel;

public class Printer {
    private Integer printerId;
    private Channel channel;
    private Integer status;

    public static int STATUS_NORMAL = 0, STATUS_NOPAPER = 4, STATUS_TOO_HOT = 128;

    public Printer(Integer printerId, Channel channel, Integer status) {
        this.printerId = printerId;
        this.channel = channel;
        this.status = status;
    }

    public Integer getPrinterId() {
        return printerId;
    }

    public void setPrinterId(Integer printerId) {
        this.printerId = printerId;
    }

    public Channel getChannel() {
        return channel;
    }

    public void setChannel(Channel channel) {
        this.channel = channel;
    }

    public Integer getStatus() {
        return status;
    }

    public void setStatus(Integer status) {
        this.status = status;
    }

    public static void main(String[] args) throws UnsupportedEncodingException {
        String byteStr = "1B 59 41 55 01 0A 0A 1b 61 01 1b 21 30 C3 C0 CD C5 CD"
                + " E2 C2 F4 0A 1b 61 00 1b 21 00 CF C2 B5 A5 CA B1 BC E4 A3 BA 32 30 31 37 C4 EA 39"
                + " D4 C2 31 30 C8 D5 20 31 32 3A 32 30 0A D4 DA CF DF D6 A7 B8 B6 28 D2 D1 D6 A7"
                + " B8 B6 29 0A B6 A9 B5 A5 BA C5 A3 BA 32 30 31 37 30 39 31 30 30 30 30 30 31 0A 0A"
                + " 2D 20 2D 20 2D 20 2D 20 2D 20 2D 20 2D 20 2D 20 2D 20 2D 20 2D 20 2D 20 2D 2D"
                + " 20 2D 20 2D 20 0A B2 CB C3 FB 20 20 20 20 20 20 20 20 CA FD C1 BF 20 20 20 20 20"
                + " 20 20 20 BD F0 B6 EE 0A B0 D7 C7 D0 BC A6 20 20 20 20 20 20 31 20 20 20 20 20 20"
                + " 20 20 20 20 20 31 35 0A 2D 20 2D 20 2D 20 2D 20 2D 20 2D 20 2D 20 2D 20 2D 20 2D"
                + " 20 2D 20 2D 20 2D 2D 20 2D 20 2D 20 0A 1b 61 02 1b 21 30 D7 DC BD F0 B6 EE 3A 31"
                + " 35 0A 1b 61 00 1b 21 00 CB CD BB F5 B5 D8 D6 B7 A3 BA 0A C9 EE DB DA CA D0 C1"
                + " FA B8 DA C7 F8 C0 EE C0 CA B9 FA BC CA D6 E9 B1 A6 D4 B0 41 31 B6 B0 31 30 30 31"
                + " 0A C1 AA CF B5 C8 CB 3A D5 C5 C8 FD 0A B5 E7 BB B0 3A 31 33 38 31 32 33 34 35 36"
                + " 37 38 0A 0A 0A 0A 0A";
        String[] arr = byteStr.split("\\s+");
        byte[] bytes = new byte[arr.length];
        int i = 0;
        for (String str : arr) {
            bytes[i++] = UnsignedBytes.parseUnsignedByte(str, 16);
        }
        System.out.println(new String(bytes, "gbk"));
    }
}